package com.situ.javase.day9;

import java.util.ArrayList;

import org.junit.Test;

public class BaoZhuangLeiXingDemo {

	@Test
	public void test1() {
		int num = 3;
		int[] array1 = new int[3];
		Student[] array2 = new Student[3];
		//ArrayList<int> list1 = new ArrayList<int>();
		ArrayList<Integer> list2 = new ArrayList<Integer>();
		
	}
	
	@Test
	public void test2() {
		ArrayList<Integer> list = new ArrayList<Integer>();
		list.add(2);
		list.add(12);
		for (Integer integer : list) {
			System.out.println(integer);
		}
		
		// int类型最大值
		System.out.println(Integer.MAX_VALUE);
		System.out.println(Integer.MIN_VALUE);
		
		// 自动拆箱和装箱
		//Integer integer = new Integer(4);
		Integer integer = 4;// 自动装箱(等价于上面操作)
		int i = integer.intValue();
		int num = 4;
		num = num + 2;
		integer = integer + 2;// 自动拆箱integer.intValue()
		// integer.intValue() + 2 = 6;
		// 得到int类型的6有赋值给Integer类型，自动装箱
		System.out.println(integer);
	}
	
	@Test
	public void test55() {
		Teacher teacher = new Teacher();
		System.out.println(teacher.id);//0
		System.out.println(teacher.d);//0.0
		System.out.println(teacher.bool);//false
		System.out.println(teacher.str);//null
	}
	
	@Test
	public void test66() {
		String str = "20";
		// 第一种方式
		int value1 = Integer.parseInt(str);
		System.out.println(value1);
		// 第二种方式
		Integer integer = new Integer(str);
		int value2 = integer.intValue();
		System.out.println(value2);
		
		String str2 = "3.14";
		double d = Double.parseDouble(str2);
		System.out.println(d);
		String str3 = "true";
		boolean bool = Boolean.parseBoolean(str3);
		System.out.println(bool);
		// xxx value = XXX.parseXXX(String str)
	}
	
	@Test
	public void test5555() {
		String str = "12a";
		int i = Integer.parseInt(str);
		System.out.println(i);
	}
	
	public static void main(String[] args) {
		String str = "";
		int i = Integer.parseInt(str);
		System.out.println(i);
	}
	
}
